package com.controller.expert;

import com.entity.expert.NeedsDetails;
import com.entity.share.Paging;
import com.service.expert.NeedsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
public class NeedsController {
    @Autowired
    private NeedsService needsService;

    /**
     * 查询需求
     * @return
     * paging:分页
     * 参数
     * page：第几页
     * limit：几条数据
     * 
     * state:状态
     */
    @GetMapping("queryNeedsAll")
    public Object queryNeedsAll(Paging paging, String state, HttpServletRequest request){
        String expertID =  request.getHeader("TOKEN");
        return needsService.queryNeedsAll(paging,state,Integer.parseInt(expertID));
    }

    /**
     * 专家受理需求
     * @param needsID 需求编号
     * @param state 状态
     * @param request
     * @return
     */
    @GetMapping("expertsAcceptance")
    public Object expertsAcceptance(Integer needsID,String state, HttpServletRequest request){

        String expertID =  request.getHeader("TOKEN");
        return needsService.expertsAcceptance(needsID,Integer.parseInt(expertID),state);
    }


}
